package com.mathassistant.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Image;
import com.mathassistant.client.presenter.TitleContentPresenter.Display;

public class TitleContentView extends Composite implements Display{

	private static TitleContentViewUiBinder uiBinder = GWT
			.create(TitleContentViewUiBinder.class);
	@UiField Label currentTitleLabel;
	@UiField Hyperlink addExNewHyperlink;
	@UiField Image addExImage;

	interface TitleContentViewUiBinder extends
			UiBinder<Widget, TitleContentView> {
	}

	public TitleContentView() {
		initWidget(uiBinder.createAndBindUi(this));
	}
	
	@Override
	public HasClickHandlers getAddExerciseHyperLink() {
		// TODO Auto-generated method stub
		return addExNewHyperlink;
	}
	
	@Override
	public HasClickHandlers getAddExerciseImage() {
		// TODO Auto-generated method stub
		return addExImage;
	}
	
	@Override
	public void setCurrentTitle(String title) {
		// TODO Auto-generated method stub
		currentTitleLabel.setText(title);
	}
	
	@Override
	public void setTextAnchor(String text) {
		// TODO Auto-generated method stub
		addExNewHyperlink.setText(text);
	}
	
	@Override
	public void setStateAdmin() {
		// TODO Auto-generated method stub
		addExImage.setVisible(true);
		addExNewHyperlink.setVisible(true);
	}
	
	@Override
	public void setStateNormal() {
		// TODO Auto-generated method stub
		addExImage.setVisible(false);
		addExNewHyperlink.setVisible(false);
	}
	
	@Override
	public Widget asWidget() {
		// TODO Auto-generated method stub
		return this;
	}
}
